package com.itheima.dao;

import com.itheima.domain.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.Mapping;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: ly
 * @Date: 2021/07/14/8:49
 * @Description:
 */
//@Mapping
public interface UserDao {
    @Select("select * from user where id=#{id}")
    public User findById(Integer id);

    @Select("select * from user")
    public List<User> findAll();

    @Insert("insert into user values (null,#username,#password)")
    public Integer addUser(User user);

    @Delete("delete from user where id=#{id}")
    public Integer deleteUser(Integer id);

    @Update("update user  set username=#{username} password=#{password} where id=#{id}")
    public Integer updateUser(User user);
}
